package Game;

/**
 * The platform is a collection of blocks in a line.
 * @author Ilya
 *
 */
public class Platform extends Entity {
	Position mPosition;
	double width;
	
	private static final double height = 10;
	
	/**
	 * Spawns the platform at a height with a number of blocks.
	 * @param length
	 * @param y
	 */
	public Platform(GameModel gameModel, double width, Position position) {
		super(gameModel);
		
		mPosition = position;
		this.width = width;
	}
	
	public Position getPosition() {
		return new Position(mPosition);
	}
	
	public double getWidth() {
		return width;
	}
	
	public void gameLoop(double dt) {
		mPosition.SetX(mPosition.getX() - getGameModel().getSpeed() * dt);
		
		if(mPosition.getX() + width < 0.0) {
			getGameModel().killPlatform(this);
		}
	}
	
	public double getHeight() {
		return height;
	}
}
